home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / doc / foreach.n < prev    next >
Encoding:
Text File  |  1994-12-17  |  1.1 KB  |  35 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" Copyright (c) 1994 Sun Microsystems, Inc.
  4. '\"
  5. '\" See the file "license.terms" for information on usage and redistribution
  6. '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  7. '\" 
  8. '\" @(#) foreach.n 1.2 94/12/17 16:17:57
  9. '\" 
  10. .so man.macros
  11. .HS foreach tcl
  12. .BS
  13. '\" Note:  do not modify the .SH NAME line immediately below!
  14. .SH NAME
  15. foreach \- Iterate over all elements in a list
  16. .SH SYNOPSIS
  17. \fBforeach \fIvarname list body\fR
  18. .BE
  19.  
  20. .SH DESCRIPTION
  21. .PP
  22. In this command \fIvarname\fR is the name of a variable, \fIlist\fR
  23. is a list of values to assign to \fIvarname\fR, and \fIbody\fR is a
  24. Tcl script.
  25. For each element of \fIlist\fR (in order
  26. from left to right), \fBforeach\fR assigns the contents of the
  27. field to \fIvarname\fR as if the \fBlindex\fR command had been used
  28. to extract the field, then calls the Tcl interpreter to execute
  29. \fIbody\fR.  The \fBbreak\fR and \fBcontinue\fR statements may be
  30. invoked inside \fIbody\fR, with the same effect as in the \fBfor\fR
  31. command.  \fBForeach\fR returns an empty string.
  32.  
  33. .SH KEYWORDS
  34. foreach, iteration, list, looping
  35.